fix: fallback adapters report the active instance's model/provider - #6690
Open
Fyko wants to merge 3 commits into
Open
fix: fallback adapters report the active instance's model/provider#6690Fyko wants to merge 3 commits into
Fyko wants to merge 3 commits into
Conversation
longcw
reviewed
Aug 4, 2026
| def model(self) -> str: | ||
| return "FallbackAdapter" | ||
| """The model of the instance that most recently served a request (the primary before any traffic).""" # noqa: E501 | ||
| return self._active_instance.model |
Contributor
There was a problem hiding this comment.
The nested llm_request span already carries the real gen_ai.request.model, so model can stay "FallbackAdapter".
The only gap is lk.agents.turn.*, whose labels come from MetricsReport at three sites (agent_activity:3380, :3385, :4457). Maybe add a single metrics_metadata property, read at those three sites, splits the histograms and keeps model, ErrorEvent, and the user_turn span stable.
if TYPE_CHECKING:
from ..llm.chat_context import MetricsMetadata
@property
def metrics_metadata(self) -> MetricsMetadata: # base classes return their own model/provider
return self._active_instance.metrics_metadata
Author
There was a problem hiding this comment.
ah, didn't know of that. good idea. updated in refactor: label turn metrics via metrics_metadata, keep adapter model…
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a
metrics_metadataproperty to the STT/TTS/LLM/RealtimeModel base classes (returns ownmodel/provider), overridden by the fallback adapters to report the instance that most recently served a request. The threelk.agents.turn.*label sites inagent_activity.pynow read it. Adaptermodel/providerstay"FallbackAdapter"/"livekit"for spans, logs, and error events.Why
Turn histograms labeled from the top-level component collapse into one
model_name="FallbackAdapter"series with a fallback adapter — you can't tell your primary's ttfb from your fallback's. Discussed with the LiveKit team in slack; surfacing the actual provider was agreed on. Scoped tometrics_metadataper @longcw's review, keeping the adapter's own identity stable everywhere else.Semantics: the primary before any traffic, the last instance to produce output after that. Recovery probes never relabel. Tests cover all four adapters, including probe-doesn't-relabel and fresh-session-resets-to-primary.
https://claude.ai/code/session_01AkHCx6Qfu5i2Z6h8Pa82gE